package org.phnq.babel.util;

import java.io.*;

public class IStreamWrapper extends InputStream
{
	private int nativeRef;
	
	public IStreamWrapper(int nativeRef)
	{
		super();
		
		this.nativeRef = nativeRef;
	}
	
	public int read() throws IOException
	{
		return readNative(nativeRef);
	}
	
	public int read(byte[] b) throws IOException
	{
		return read(b, 0, b.length);
	}

	public int read(byte[] b, int off, int len) throws IOException
	{
		return readNative(nativeRef, b, off, len);
	}

	private native int readNative(int nativeRef);
	private native int readNative(int nativeRef, byte[] b, int off, int len);
}
